<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="org.lsms.dao.impl.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>

		<title>Author Paper History Page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="LSMS,ICSEE,AUTHOR">

		<link rel="stylesheet" type="text/css" href="../css/author_layout.css">
		<link rel="stylesheet" type="text/css"
			href="../css/hyper_link_style.css">

		<style type="text/css">
p {
	text-align: justify;
	font-size: small;
	font-family: Arial;
}

#content table th {
	border: 1px solid black;
	text-align: center;
}

#content table td {
	border: 1px solid black;
	text-align: center;
}

#content table {
	border: 1px solid black;
	border-spacing: 0;
	border-collapse: collapse;
	width: 680px;
}
</style>
	</head>

	<body>
		<div id="container">
			<div id="header" class="logo_image"></div>
			<div class="nav"></div>
			<div id="author_menu" class="border">
				<table border="0" width="100%">
					<tr>
						<td bgcolor="#CCCCCC">
							<a href="../index.jsp">Home</a>
						</td>
					</tr>
					<tr>
						<%
							DaoImpl impl_set = new DaoImpl();
							HashMap<String, Integer> hm_set = impl_set.get_site_setting();
							int paper_submit = hm_set.get("paper_submit");
							if (paper_submit == 1) {
						%>
						<td bgcolor="#CCCCCC">
							<a href="submit_paper.jsp">Submit Paper</a>
						</td>
						<%
							} else {
						%>
						<td bgcolor="#CCCCCC">
							<a href="../error/submit_paper_forbidden.jsp">Submit Paper</a>
						</td>
						<%
							}
						%>
					</tr>
					<tr>
						<td bgcolor="#CCCCCC">
							<a href="paper_history.jsp">History / Paper Status</a>
						</td>
					</tr>
					<tr>
						<td bgcolor="#CCCCCC">
							<a href="register_info.jsp">Register Information</a>
						</td>
					</tr>
					<tr>
						<td bgcolor="#CCCCCC">
							<a href="modify_info.jsp">Modify Information</a>
						</td>
					</tr>
					<tr>
						<td bgcolor="#CCCCCC">
							<a href="../logout">Log Out</a>
						</td>
					</tr>
				</table>
			</div>

			<div id="content" class="bg_color border">
				<div style="margin: 15px">

					<b>Paper History</b>
					<br>
					<br>

					<table>

						<tr>
							<th>
								Paper id
							</th>
							<th>
								Paper Title
							</th>
							<th>
								Authors
							</th>
							<th>
								Submit Date
							</th>
							<th>
								Statue
							</th>
							<th>
								Download
							</th>
						</tr>
						<%
							DaoImpl impl = new DaoImpl();
							int userid = Integer.parseInt(session.getAttribute("userid")
									.toString());
							//System.out.println(userid);
							HashMap hm = impl.select_all_paper(userid);
							Set<Integer> set = hm.keySet();
							Iterator it = set.iterator();
							while (it.hasNext()) {
								Integer i = (Integer) it.next();
								//System.out.println(i);
								//System.out.println(((org.lsms.bean.Paper)hm.get(i)).getPapertitle());
								//System.out.println(((org.lsms.bean.Paper)hm.get(i)).getAuthorname());
								//System.out.println(((org.lsms.bean.Paper)hm.get(i)).getPapersubmitdate());
						%>
						<tr>
							<td>
								<%
									out.print(i);
										//System.out.print(i);
								%>
							</td>
							<td>
								<%
									out.print(((org.lsms.bean.Paper) hm.get(i)).getPapertitle());
										//System.out.print(((org.lsms.bean.Paper)hm.get(i)).getPapertitle());
								%>
							</td>
							<td>
								<%
									out.print(((org.lsms.bean.Paper) hm.get(i)).getAuthorname());
										//System.out.print(((org.lsms.bean.Paper)hm.get(i)).getAuthorname());
								%>
							</td>
							<td>
								<%
									out.print(((org.lsms.bean.Paper) hm.get(i))
												.getPapersubmitdate());
										//System.out.print(((org.lsms.bean.Paper)hm.get(i)).getPapersubmitdate());
								%>
							</td>
							<td>
								<%
									int status = (((org.lsms.bean.Paper) hm.get(i))
												.getPaperstatus());
										if (status == 1) {
								%>
								<font color="green">Pass</font>
								<%
									} else {
								%>
								<font color="red">Not Pass</font>
								<%
									}
								%>
							</td>

							<td>
							<%
								String savename = "..";
								String url = impl.get_paper_sava_name(i);
								savename +=url;
							 %>
								<a href="<%=savename %>">Download</a>
							</td>
						</tr>
						<%
							}
						%>
					</table>
				</div>
			</div>
			<div class="nav"></div>

			<div id="footer" class="footer_color border">
				<p style="text-align: center">
					<b>&copy;2010 LSMS-All Rights Reserved.</b>
				</p>
				<p style="text-align: center">
					<b>Powered by Shu.</b>
				</p>
			</div>
		</div>
	</body>
</html>
